<?php

use yii\db\Migration;

/**
 * Class m171205_084323_addColumnToCourse
 */
class m171205_084323_addColumnToCourse extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $this->addColumn('{{%course}}','is_charge',$this->smallInteger()->notNull()->defaultValue(0)->comment('是否收费 0-不收费 1-收费'));
        $this->addColumn('{{%course}}','is_top',$this->smallInteger()->notNull()->defaultValue(0)->comment('是否置顶 0-不置顶 1-置顶'));
        $this->addColumn('{{%course}}','toped_at',$this->integer()->notNull()->defaultValue(0)->comment('置顶时间'));
    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        $this->dropColumn('{{%course}}','is_charge');
        $this->dropColumn('{{%course}}','is_top');
        $this->dropColumn('{{%course}}','toped_at');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m171205_084323_addColumnToCourse cannot be reverted.\n";

        return false;
    }
    */
}
